ISRO CSE 2018
Q24.
Consider the following C code segment int f(int x) { if(x<1) return 1; else return (f(x-1) + g(x)); } int g(int x) { if(x<2) return 2; else return (f(x-1) + g(x/2)); }Of the following, which best describes the growth of f(x) as a function of x ?Q25.
Consider the following C++ program int a (int m) {return ++m;} int b(int&m) {return ++m;} int{char &m} {return ++m;} void main() { int p = 0, q=0, r = 0; p += a(b(p)) ; q+= b(a(q);) r+=a(c(r)); cout << p << q << r; } Assuming the required header first are already included, the above programQ26.
A language with string manipulation facilities uses the following operations. head(s)- returns the first character of the string stails(s)- returns all but the first character of the string sconcat(s1,s2)- concatenates string s1 with s2. The output of concat(head(s), head(tail(tail(s)))), where s is acbc is:Q27.
A hash table with 10 buckets with one slot pet per bucket is depicted here. The symbols, S1 to S7 are initially entered using a hashing function with linear probing. The maximum number of comparisons needed in searching an item that is not present is:\begin{array}{|c|c|} \hline 0 & S 7 \\ \hline 1 & S 1 \\ \hline 2 & \\ \hline 3 & S 4 \\ \hline 4 & S 2 \\ \hline 5 & \\ \hline 6 & S 5 \\ \hline 7 & \\ \hline 8 & S 6 \\ \hline 9 & S 3 \\ \hline \end{array}Q29.
Given a binary-max heap. The elements are stored in an arrays as 25,14,16,13,10,8,12. What is the content of the array after two delete operations?